import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.Base64;

public class Main {
    public static void main(String[] args) throws UnsupportedEncodingException {
        String x = "四四大";
        System.out.println("GBK:" + Arrays.toString(x.getBytes("ASCII")));
        String s = "a丂喝摸摸大";
        System.out.println("GBK:" + Arrays.toString(s.getBytes("GBK")));
        System.out.println("UTF8:" + Arrays.toString(s.getBytes("UTF-8")));
        System.out.println("Unicode:" + Arrays.toString(s.getBytes("Unicode")));
//        System.out.println(0xffffffff);

        //为了让Base64编码是4的倍数，就要补2个等号；
        byte[] a = "阿斯".getBytes("UTF-8");
        System.out.println("UTF118:" + Arrays.toString("知".getBytes("UTF-8")));
        byte[] b = Base64.getEncoder().encode("阿斯".getBytes());
        System.out.println(Arrays.toString(Base64.getDecoder().decode(b)));
        System.out.println(new String(b));
        System.out.println(new String(Base64.getDecoder().decode(b), "UTF-8"));
    }
}
